<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../jsLib/angular.js"></script>

    <title></title>
</head>
<body  ng-app="app" >
<hello ng-controller="myCotrol"></hello>

<script>
    var app = angular.module('app',[]);
    app.controller("myCotrol",function($scope){
        $scope.click1 = function(){
            alert(1);
        }
    })
    app.directive('hello',function(){
        return{
            restrict:"AE",
            templateUrl:"2.html",
            replace:"true",
             link:function(scope,element,attr){
                 element.on('click',function(){
                     scope.click1();
                 })
             }
        }
    })
</script>
</body>
</html>